package cn.two.controller;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;




import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.two.model.OaUser;
import cn.two.service.oaUserService;

@Controller
@RequestMapping("/login")
public class loginController {

	@Resource
	private oaUserService oaUserService;
	
	@RequestMapping("/login")
	public String login(){
		return "login";
		
	}
	
	@RequestMapping("/userLogin")
	public String login(OaUser oaUser,HttpSession session,Model model) throws IOException{	
	
		OaUser User=oaUserService.login(oaUser);
		if(User!=null){
	    	session.setAttribute("oauser", User);
	    	return "redirect:/applyMoney/index";
	    }else{
	    	return "login";
	    }
		
	}
}
